<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style">
    <div
      :class="{
        content3: !props.info.value && !props.info.remarks && props.info.subTitle,
        content2: !props.info.value && !props.info.remarks && !props.info.subTitle,
      }"
      class="content outline-parent-bg"
      :style="{
        backgroundImage:
          !props.info.value && !props.info.remarks
            ? `url(${publicUrls + 'free/style12/Level1outlineStyle1Bg2.webp'})`
            : `url(${publicUrls + 'free/style12/Level1outlineStyle1Bg.webp'})`,
      }"
    >
      <div
        class="right-cover"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style12/Level1outlineStyle1rightBg.webp'})`,
        }"
      ></div>
      <div
        class="Showroom-parent"
        :class="{ 'Showroom-parent1': route.meta.loopType }"
        v-if="props.info.digitalShowroom"
      >
        <digitalShowroomIcon :url="props.info.digitalShowroom" :id="props.info.id" />
      </div>
      <div class="title-box" :class="{ 'title2-box': props.info.text.length > 9 }">
        <div
          class="title-top"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style12/Level1outlinetitle1Bg.webp'})`,
          }"
        ></div>
        <span>{{ props.info.text }}</span>
        <div
          class="title-bottom"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style12/Level1outlinetitle2Bg.webp'})`,
          }"
        ></div>
      </div>
      <p
        class="subtitle"
        :class="{
          'subtitle-2': props.info.value && props.info.remarks && props.info.text.length > 9,
          'subtitle-3': !props.info.value && props.info.remarks && props.info.text.length <= 9,
          'subtitle-4': !props.info.value && props.info.remarks && props.info.text.length > 9,
          'subtitle-5': props.info.value && !props.info.remarks && props.info.text.length > 9,
          'subtitle-6': props.info.value && !props.info.remarks && props.info.text.length > 9,
        }"
        v-if="props.info.subTitle"
      >
        {{ props.info.subTitle }}
      </p>

      <div
        class="img-box"
        :style="{
          backgroundImage: props.info.remarks
            ? `url(${publicUrls + 'free/style12/Level1outlineStyle1coverBg.webp'})`
            : `url(${publicUrls + 'free/style12/Level1outlineStyle1cover2Bg.webp'})`,
        }"
        :class="{
          'img-box4': !props.info.subTitle && !props.info.remarks && props.info.text.length > 9,
          'img-box5': !props.info.subTitle && !props.info.remarks && props.info.text.length <= 9,
          'img-box6': props.info.subTitle && !props.info.remarks && props.info.text.length > 9,
          'img-box7': props.info.subTitle && !props.info.remarks && props.info.text.length <= 9,
          'img-box1': props.info.remarks && props.info.subTitle && props.info.text.length <= 9,
          'img-box2': !props.info.subTitle && props.info.remarks && props.info.text.length <= 9,
          'img-box3': !props.info.subTitle && props.info.remarks && props.info.text.length > 9,
        }"
        v-if="props.info.value"
      >
        <div class="outline-cover">
          <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/w/1000/format/webp'" alt="" />
        </div>
      </div>
      <div class="remarks1" v-if="props.info.value">
        <TextMax
          :infoData="props.info"
          v-if="props.domShow"
          :data="props.info.remarks"
          :title="props.info.text"
          :row="getRemarksNum(6, route.meta.loopType)"
        ></TextMax>
      </div>
      <div
        class="remarks2"
        :class="{
          remarks3: !props.info.subTitle && props.info.text.length > 9,
          remarks4: !props.info.subTitle && props.info.text.length <= 9,
        }"
        v-else-if="props.info.remarks"
      >
        <TextMax
          :infoData="props.info"
          v-if="props.domShow"
          :data="props.info.remarks"
          :title="props.info.text"
          :row="!props.info.subTitle ? getRemarksNum(13, route.meta.loopType) : getRemarksNum(13, route.meta.loopType)"
        ></TextMax>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free12Style1',
});
</script>

<script setup lang="ts">
import { getRemarksNum } from '@/utils/minxin';
import digitalShowroomIcon from '@/freeComponents/unitdigitalShowroom/style12.vue';
import { publicUrls } from '@/utils/minxin';
import { getTextHtml, textType } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { computed, defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/textMax12.vue';
import { useProjectStore } from '@/store';
import { useRouter, useRoute } from 'vue-router';
const route = useRoute();
const ImgVisible = ref(false);
const store = useProjectStore();
const title = ref();

const props = defineProps({
  indexs: {
    type: Number || String,
  },
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 40px;
  // margin-left: 120px;
  margin-top: 0;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 740px;
  height: 100%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding-right: 240px;
}
.content2 {
  justify-content: center;
  .title-box {
    margin-top: 0;
  }
  .subtitle {
  }
}
.content3 {
  .title-box {
    margin-top: 353px;
  }
  .subtitle {
    margin-top: 20px;
  }
}
.Showroom-parent {
  display: flex;
  position: absolute;
  top: 14px;
  right: 254px;
  z-index: 15;
  width: 54px;
  height: 51px;
}
.right-cover {
  position: absolute;
  width: 235px;
  height: 333px;
  top: 0px;
  right: -20px;

  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.Showroom-parent1 {
  top: 14px;
  right: 254px;
}
.title-box {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 399px;
  max-height: 118px;
  padding: 11px 0;
  margin-top: 74px;

  span {
    width: 290px;
    font-family: Alimama DongFangDaKai;
    font-size: 32px;
    font-weight: 400;
    line-height: 48px;
    text-align: center;
    background: linear-gradient(90deg, #ffeabc 0%, #fec64b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
.title-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 11px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.title-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 11px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.title2-box {
  margin-top: 50px;
}
.subtitle {
  width: 368px;
  font-family: PingFang SC;
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  text-align: center;
  color: rgba(255, 227, 162, 1);
  margin-top: 96px;
}
.subtitle-2 {
  margin-top: 120px;
}
.subtitle-3 {
  margin-top: 123px;
}
.subtitle-4 {
  margin-top: 147px;
}
.subtitle-5 {
  margin-top: 96px;
}
.subtitle-6 {
  margin-top: 120px;
}
.img-box {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: 414px;
  height: 211px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  margin-top: 34px;
  .outline-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 364px;
    height: calc(100% - 8px);
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 364px;
      height: 100%;
      object-fit: contain;
    }
  }
}
.img-box:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
.img-box1 {
  margin-top: 30px;
}
.img-box2 {
  margin-top: 177px;
}
.img-box3 {
  margin-top: 153px;
}
.img-box4 {
  height: 422px;
  margin-top: 153px;
}
.img-box5 {
  height: 422px;
  margin-top: 177px;
}
.img-box6 {
  height: 422px;
  margin-top: 30px;
}
.img-box7 {
  height: 422px;
  margin-top: 30px;
}
.remarks1 {
  width: 368px;
  margin-top: 30px;
}
.remarks2 {
  width: 368px;
  margin-top: 20px;
}
.remarks3 {
  margin-top: 161px;
}
.remarks4 {
  margin-top: 185px;
}
</style>
